<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      >


    <h:body>
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.searchTitle}"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:form>
                    <h:panelGrid columns="4">
                    <h:outputLabel value="#{bundle.SEARCH}:" for="search"/>
                    <h:inputText id="search" required="true" requiredMessage="#{bundle.OBLIG}" value="#{courseController.searchWord}"/>
                    <h:commandButton value="#{bundle.SEARCH}"/>
                    <h:message for="search" />
            </h:panelGrid>
          

            <h:outputText escape="false" value="#{bundle.noResults}" rendered="#{courseController.searchResult.rowCount == 0}"/>
            <h:panelGroup rendered="#{courseController.searchResult.rowCount > 0}">
                <h:dataTable value="#{courseController.searchResult}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.courseCode}"/>
                        </f:facet>
                        <h:outputText value="#{item.courseCode}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.courseName}"/>
                        </f:facet>
                            <h:outputText value="#{item.courseName}" rendered="#{localeHelper.englishSet}" />
                            <h:outputText value="#{item.courseNameNo}" rendered="#{localeHelper.norwegianSet}" />

                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.faculty}"/>
                        </f:facet>
                        <h:outputText value="#{item.faculty.facultyName}" rendered="#{localeHelper.englishSet}" />
                        <h:outputText value="#{item.faculty.facultyNameNo}" rendered="#{localeHelper.norwegianSet}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>
                        <h:commandLink action="#{courseController.prepareView}" value="#{bundle.VIEW}"/>
                    </h:column>
                </h:dataTable>
            </h:panelGroup>
            </h:form>
 
         

        </ui:define>
   </ui:composition>
    </h:body>
</html>
